#!/usr/bin/python

import sys
from qrtools import QR

def decode(filepath):
	myCode = QR(filename=filepath)
	if myCode.decode():
		print myCode.data
	else:
		sys.exit('Unable to read QR code!')

if __name__ == '__main__':
	if len(sys.argv) > 1:
		decode(unicode(sys.argv[1]))
	else:
		sys.exit('usage: python qrdecode.py <filepath>')
